# -*- coding:utf-8 -*-
import jsonschema

resp = {
    "name": "还是沈老师",
    "age": 18,
    "hobby": ["干饭", "睡觉"],
    "is_girl": False,
    "score": {"python": 60, "接口测试": 66}
}
schema = {
    "type": "object",
    "propertise": {
        "name": {"const": "还是沈老师"},
        "age": {"const": 18},
        "hobby": {"const": ["干饭", "睡觉"]},
        "is_girl": {"const": False},
        "score": {"type": "object",
                  "propertise": {
                      "python": {"const": 60},
                      "接口测试": {"const": 66}
                  }}
    },
    "reuired": ["name", "score", "hobby", "is_girl"]
}
# 调用jsonschema中校验方法，校验数据
res = jsonschema.validate(instance=resp, schema=schema)
print(res)
